/*     */ package com.lmpop.trade.ti_voucher;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.dao.IbatisDbmImpl;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_voucherInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_voucherInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ti_voucher Ti_voucher = new Ti_voucher();
/*  26 */     Ti_voucher.setVoucher_id(map.getString("voucher_id"));
/*  27 */     Ti_voucher.setVoucher_type(map.getString("voucher_type"));
/*  28 */     Ti_voucher.setVoucher_name(map.getString("voucher_name"));
/*  29 */     Ti_voucher.setUsage_rules(map.getInt("usage_rules"));
/*  30 */     Ti_voucher.setStart_time(map.getString("start_time"));
/*  31 */     Ti_voucher.setEnd_time(map.getString("end_time"));
/*  32 */     Ti_voucher.setMoney(map.getString("money"));
/*  33 */     Ti_voucher.setProperty_type(map.getString("property_type"));
/*  34 */     Ti_voucher.setUser_id(map.getString("user_id"));
/*  35 */     Ti_voucher.setState_code(map.getString("state_code"));
/*     */ 
/*  37 */     String result_code = "0";
/*     */     try {
/*  39 */       insert(dbmMgr, Ti_voucher);
/*     */     } catch (ApplicationException e) {
/*  41 */       e.printStackTrace();
/*  42 */       result_code = "1";
/*     */     }
/*  44 */     map.setString("result_code", result_code);
/*  45 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_voucher Ti_voucher)
/*     */     throws ApplicationException
/*     */   {
/*  54 */     dbmMgr.update("insertTi_voucher", Ti_voucher);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  64 */     String pkid_string = map.getString("pkid");
/*  65 */     String result_code = "0";
/*     */     try {
/*  67 */       if (!pkid_string.equals("")) {
/*  68 */         String[] pkStr = pkid_string.split("\\|");
/*  69 */         for (int i = 0; i < pkStr.length; i++) {
/*  70 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  74 */       e.printStackTrace();
/*  75 */       result_code = "1";
/*     */     }
/*  77 */     map.setString("result_code", result_code);
/*  78 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  87 */     dbmMgr.update("deleteTi_voucher", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  96 */     Ti_voucher Ti_voucher = new Ti_voucher();
/*  97 */     Ti_voucher.setVoucher_id(map.getString("voucher_id"));
/*  98 */     Ti_voucher.setVoucher_type(map.getString("voucher_type"));
/*  99 */     Ti_voucher.setVoucher_name(map.getString("voucher_name"));
/* 100 */     Ti_voucher.setUsage_rules(map.getInt("usage_rules"));
/* 101 */     Ti_voucher.setStart_time(map.getString("start_time"));
/* 102 */     Ti_voucher.setEnd_time(map.getString("end_time"));
/* 103 */     Ti_voucher.setMoney(map.getString("money"));
/* 104 */     Ti_voucher.setProperty_type(map.getString("property_type"));
/* 105 */     Ti_voucher.setUser_id(map.getString("user_id"));
/* 106 */     Ti_voucher.setState_code(map.getString("state_code"));
/*     */ 
/* 108 */     String result_code = "0";
/*     */     try {
/* 110 */       update(dbmMgr, Ti_voucher);
/*     */     } catch (ApplicationException e) {
/* 112 */       e.printStackTrace();
/* 113 */       result_code = "1";
/*     */     }
/* 115 */     map.setString("result_code", result_code);
/* 116 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_voucher Ti_voucher)
/*     */     throws ApplicationException
/*     */   {
/* 125 */     dbmMgr.update("updateTi_voucher", Ti_voucher);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 135 */     Hashtable Ti_voucher = (Hashtable)obj;
/* 136 */     if (start == 0)
/* 137 */       start = 0;
/*     */     else {
/* 139 */       start = (start - 1) * limit;
/*     */     }
/* 141 */     Ti_voucher.put("start", Integer.valueOf(start));
/* 142 */     Ti_voucher.put("limit", Integer.valueOf(limit));
/* 143 */     return this.queryList.getList("getListByTi_voucherPage", Ti_voucher);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 154 */     Hashtable Ti_voucher = (Hashtable)obj;
/* 155 */     List list = this.queryList.getList("getCountByObjTi_voucher", Ti_voucher);
/* 156 */     int count = 0;
/* 157 */     if ((list != null) && (list.size() > 0)) {
/* 158 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 159 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 160 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 163 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 173 */     return this.queryList.getList("getTi_voucherByPk", pk);
/*     */   }
/*     */ 
/*     */   public void setVoucherStateByType(String type, int row) {
/* 177 */     Map map = new Hashtable();
/* 178 */     map.put("voucher_type", type);
/* 179 */     map.put("row", Integer.valueOf(row));
/* 180 */     DbmInterf dbmMgr = new IbatisDbmImpl();
/* 181 */     dbmMgr.updateSql("setVoucherStateByType", map);
/*     */   }
/*     */ 
/*     */   public int checkVoucher(String start, String end) {
/* 185 */     int count = 0;
/* 186 */     return count;
/*     */   }
/*     */ 
/*     */   public float getMoneyByType(String type) {
/* 190 */     List list = this.queryList.getList("getMoneyByType", type);
/* 191 */     if ((list != null) && (list.size() > 0)) {
/* 192 */       return Float.parseFloat(((Hashtable)list.get(0)).get("money").toString());
/*     */     }
/* 194 */     return 0.0F;
/*     */   }
/*     */ 
/*     */   public int checkVoucherStockNum(String type) {
/* 198 */     List list = this.queryList.getList("checkVoucherStockNum", type);
/* 199 */     if ((list != null) && (list.size() > 0)) {
/* 200 */       return Integer.parseInt(((Hashtable)list.get(0)).get("count").toString());
/*     */     }
/* 202 */     return 0;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_voucher.Ti_voucherInfo
 * JD-Core Version:    0.6.0
 */